<{include file="file:$xoops_rootpath/modules/fileManager/admin/templates/fileManager_header.html"}>

<{* --- Upload --- *}>
<{if $isopen_folder}>
<ul class="toptab">
    <{if $config.dirhandle}>
        <li class="fmAddFolder"><a href='index.php?action=AddFolder&path=<{$current_path}>'><{$smarty.const._AD_FILEMANAGER_FOLDER_ADD}></a></li>
    <{/if}>
    <{if $config.multiupload eq 0}>
        <li class="fmUpload"><a href='index.php?action=MnultiUpload&path=<{$current_path}>'><{$smarty.const._AD_FILEMANAGER_UPLOAD}></a></li>
    <{else}>
        <li class="fmUpload"><a href='index.php?action=SingleUpload&path=<{$current_path}>'><{$smarty.const._AD_FILEMANAGER_UPLOAD}></a></li>
    <{/if}>
</ul>
<{/if}>

<{* --- Path  --- *}>
<div id="fmheader">
    <span class='pathlink'>
    <ul>
    <li><a href='index.php'>&nbsp;<{$smarty.const._AD_FILEMANAGER_PATH_HOME}>&nbsp;</a></li>
    <{foreach item=dpath from=$path_array}>
        <li><a href='index.php?path=<{$dpath.link}>'>&nbsp;<{$dpath.name}>&nbsp;</a></li>
    <{/foreach}>
    <ul>
    </span>
</div>
<div class="closer">&nbsp;</div>

<{* --- Page Navi --- *}>
<{if $pageNavi}><div class="pagenavi"><{xoops_pagenavi pagenavi=$pageNavi}></div><{/if}>

<{* --- List --- *}>

<form name='filter' id='filter' action='index.php' method='POST'>
    <{xoops_token form=$actionForm}>
    <{* --- Action --- *}>
    <select name="action" class="select-action">
        <option value="-1" selected="selected"><{$smarty.const._AD_FILEMANAGER_ACTION_DEFULT}></option>
        <option value="delete"><{$smarty.const._AD_FILEMANAGER_ACTION_DELETE}></option>
        <{if $ffmpeguse}><option value="capture"><{$smarty.const._AD_FILEMANAGER_ACTION_CAPTURE}></option><{/if}>
    </select>
    <{xoops_input type=hidden name=current_path value=$current_path}>
    <input value="<{$smarty.const._AD_FILEMANAGER_ACTION_SUBMIT}>" name="doaction" id="doaction" type="submit">
    <{* --- File count --- *}>
    <span>&nbsp;&nbsp;<{$xoops_upload_url}><{$current_path}>/&nbsp;&nbsp;<{$smarty.const._AD_FILEMANAGER_FILECOUNT}> : <{$files_count}></span>
    <{* --- List --- *}>
    <table width='100%' class='outer' cellspacing='1' cellpadding='3' border='0' >
    <tbody>
    <tr>
        <th align='center' width='40'>
            <{* --- check all --- *}>
            <input type='checkbox' name='rmall' id='rmall' onClick="xoopsCheckAll('filter', 'rmall')"/>
        </th>
        <th align='center' width='120'>
            <{$smarty.const._AD_FILEMANAGER_PREVIEW}>
        </th>
        <th>
            <{$smarty.const._AD_FILEMANAGER_FILENAME}>
            <a href="<{$sortNavi->renderUrlForSort()}>?sort=<{$smarty.const.FILEMANAGER_SORT_KEY_FILENAME}><{if $current_path ne ''}>&amp;path=<{$current_path}><{/if}>">
                <img src="<{"icons/up.png"|theme}>" alt="<{$smarty.const._ASCENDING}>" title="<{$smarty.const._ASCENDING}>" />
            </a>
            <a href="<{$sortNavi->renderUrlForSort()}>?sort=-<{$smarty.const.FILEMANAGER_SORT_KEY_FILENAME}><{if $current_path ne ''}>&amp;path=<{$current_path}><{/if}>">
                <img src="<{"icons/down.png"|theme}>" alt="<{$smarty.const._DESCENDING}>" title="<{$smarty.const._DESCENDING}>" />
            </a>
        </th>
        <th align='center' width='120'>
            <{$smarty.const._AD_FILEMANAGER_TYPE}>
            <a href="<{$sortNavi->renderUrlForSort()}>?sort=<{$smarty.const.FILEMANAGER_SORT_KEY_FILETYPE}><{if $current_path ne ''}>&amp;path=<{$current_path}><{/if}>">
                <img src="<{"icons/up.png"|theme}>" alt="<{$smarty.const._ASCENDING}>" title="<{$smarty.const._ASCENDING}>" />
            </a>
            <a href="<{$sortNavi->renderUrlForSort()}>?sort=-<{$smarty.const.FILEMANAGER_SORT_KEY_FILETYPE}><{if $current_path ne ''}>&amp;path=<{$current_path}><{/if}>">
                <img src="<{"icons/down.png"|theme}>" alt="<{$smarty.const._DESCENDING}>" title="<{$smarty.const._DESCENDING}>" />
            </a>
        </th>
        <th align='center' width='120'>
            <{$smarty.const._AD_FILEMANAGER_SIZE}>
            <a href="<{$sortNavi->renderUrlForSort()}>?sort=<{$smarty.const.FILEMANAGER_SORT_KEY_FILESIZE}><{if $current_path ne ''}>&amp;path=<{$current_path}><{/if}>">
                <img src="<{"icons/up.png"|theme}>" alt="<{$smarty.const._ASCENDING}>" title="<{$smarty.const._ASCENDING}>" />
            </a>
            <a href="<{$sortNavi->renderUrlForSort()}>?sort=-<{$smarty.const.FILEMANAGER_SORT_KEY_FILESIZE}><{if $current_path ne ''}>&amp;path=<{$current_path}><{/if}>">
                <img src="<{"icons/down.png"|theme}>" alt="<{$smarty.const._DESCENDING}>" title="<{$smarty.const._DESCENDING}>" />
            </a>
        </th>
        <th align='center' width='120'>
            <{$smarty.const._AD_FILEMANAGER_DATE}>
            <a href="<{$sortNavi->renderUrlForSort()}>?sort=<{$smarty.const.FILEMANAGER_SORT_KEY_FILEDATE}><{if $current_path ne ''}>&amp;path=<{$current_path}><{/if}>">
                <img src="<{"icons/up.png"|theme}>" alt="<{$smarty.const._ASCENDING}>" title="<{$smarty.const._ASCENDING}>" />
            </a>
            <a href="<{$sortNavi->renderUrlForSort()}>?sort=-<{$smarty.const.FILEMANAGER_SORT_KEY_FILEDATE}><{if $current_path ne ''}>&amp;path=<{$current_path}><{/if}>">
                <img src="<{"icons/down.png"|theme}>" alt="<{$smarty.const._DESCENDING}>" title="<{$smarty.const._DESCENDING}>" />
            </a>
        </th>
    </tr>
    <{* --- Folder List --- *}>
    <{foreach item=dir from=$dir_list}>
        <tr class="<{cycle values='even, odd'}>">
            <td></td>
            <td>
                <span class="fmFolder">
                    <a href="index.php?path=<{$dir.linkpath}>">
                    <{if $dir.folderhandle}>
                        <img src="../images/folder.png">
                    <{else}>
                        <img src="../images/folder_lock.png">
                    <{/if}>
                    <{$dir.name}>
                    </a>
                </span>
            </td>
            <td>
                <{if $config.dirhandle}>
                    <{if $dir.folderhandle}>
                        <a href="index.php?action=DelFolder&amp;path=<{$dir.linkpath}>"><img src="../images/folder_delete.png"> <{$smarty.const._AD_FILEMANAGER_DELFOLDER}></a>
                    <{/if}>
                <{/if}>
            </td>
            <td align="center"><{$smarty.const._AD_FILEMANAGER_FOLDER}></td>
            <td align="right">
                <{* --- TODO files count
                <{$dir.count}>
                 --- *}>
            </td>
            <td align="right"><{$dir.time|xoops_formattimestamp:l}></td>
        </tr>
    <{/foreach}>

    <{* --- File List --- *}>
    <{foreach item=file from=$files_list}>
        <tr class="<{cycle values='even, odd'}>">
            <td align='center'>
                <{if $isopen_folder}>
                    <input type="checkbox" name="check[]"  id="check<{$i.item_id}>" value="<{$file.file}>">
                <{/if}>
            </td>
            <td align="center">
                <{if $file.file_media eq 'IMAGE'}>
                    <{if $file.image_thumb}>
                        <a href="<{$xoops_upload_url}><{$file.file_url}>" rel="prettyPhoto[gallery]">
                        <img src="<{$xoops_upload_url}><{$file.file_url}>" width="<{$thumb_size}>" alt="<{$file.file_name}>" />
                        </a>
                    <{else}>
                        <img src='<{$xoops_upload_url}><{$file.file_url}>' alt='<{$file.file_name}>'>
                    <{/if}>
                <{elseif $file.file_media eq 'FLV'}>
                    <a href="templates/view_flv.php?file=<{$file.file_url}>&name=<{$file.file_name}>&amp;iframe=true&amp;width=500&amp;height=330" rel="prettyPhoto[iframes]">
                    <img src='../images/play.png' alt='<{$file.file_name}>' />
                    </a>
                <{elseif $file.file_media eq 'MEDIAPLAYER'}>
                    <a href="templates/view_mediaplayer.php?file=<{$file.file_url}>?iframe=true&amp;width=600&amp;height=320" rel="prettyPhoto[iframes]">
                    <img src="../images/mediaplayer.png" alt="<{$file.file_name}>" />
                    </a>
                <{elseif $file.file_media eq 'QUICKTIME'}>
                    <a href="templates/view_quicktime.php?file=<{$file.file_url}>?iframe=true&amp;width=400&amp;height=300" rel="prettyPhoto[iframes]">
                    <img src='../images/quicktime.png' alt='<{$file.file_name}>' />
                    </a>
                <{elseif $file.file_media eq 'MP3'}>
                    <a href="templates/view_quicktime_mp3.php?file=<{$file.file_url}>&name=<{$file.file_name}>?iframe=true&amp;width=400&amp;height=150" rel="prettyPhoto[iframes]">
                    <img src='../images/sound.png' alt='<{$file.file_name}>' />
                    </a>
                <{elseif $file.file_media eq 'REALPLAYER'}>
                    <a href="templates/view_realplayer.php?file=<{$file.file_url}>&name=<{$file.file_name}>?iframe=true&amp;width=500&amp;height=350" rel="prettyPhoto[iframes]">
                    <img src='../images/real.png' alt='<{$file.file_name}>' />
                    </a>
                <{elseif $file.file_media eq 'FLASH'}>
                    <a href="<{$xoops_upload_url}><{$file.file_url}>?width=450&amp;height=330&amp;flashvars=clip_id=4321799&amp;server=<{$xoops_url}>&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" rel="prettyPhoto[flash]">
                    <img src='../images/flash.png' alt='<{$file.file_name}>' />
                    </a>
                <{else}>
                <img src="../images/etc.png" alt="">
                <{/if}>
            </td>
            <td>
                <{$file.file_name}><br />
                <{if $file.file_media eq 'MEDIAPLAYER'}>
                    <{if $ffmpeguse}><a href='convert.php?file=<{$file.file_url}>&amp;path=<{$current_path}>'><{$smarty.const._AD_FILEMANAGER_ACTION_CONVERT}></a><{/if}>
                <{elseif $file.file_media eq 'QUICKTIME'}>
                    <{if $ffmpeguse}><a href='convert.php?file=<{$file.file_url}>&amp;path=<{$current_path}>'><{$smarty.const._AD_FILEMANAGER_ACTION_CONVERT}></a><{/if}>
                <{elseif $file.file_media eq 'REALPLAYER'}>
                    <{if $ffmpeguse}><a href='convert.php?file=<{$file.file_url}>&amp;path=<{$current_path}>'><{$smarty.const._AD_FILEMANAGER_ACTION_CONVERT}></a><{/if}>
                <{/if}>
                <{$file.file_info}>
            </td>
            <td align='center'><{$file.file_type}></td>
            <td align='right'><{$file.file_size}></td>
            <td align='center'><{$file.time_stamp|xoops_formattimestamp:l}></td>
        </td>
        </tr>
    <{/foreach}>
</tbody>
    </table>
</form>
<div class="pagenavi"><{xoops_pagenavi pagenavi=$pageNavi}></div>

<{* --- initialize prettyPhoto --- *}>
<script type="text/javascript">
    $(document).ready(function(){
        $("a[rel^='prettyPhoto']").prettyPhoto();
    });
</script>

